package com.frame.database.util;

import java.util.ArrayList;
import java.util.List;

import com.frame.util.SelectItem;

/**
 * @Title: 系统
 * @Description:
 * @Copyright: Copyright (c) 2013
 * @Company:
 * @author 王海锋
 * @CreatedTime:2013-7-4 上午11:25:49
 * @version 1.0
 */

public class ConditionMap {

    private List<String> paramSqlList=new ArrayList<String>();
    private List paramObjList=new ArrayList();
    private List<SelectItem> order;

    public ConditionMap put(String condition){
        paramSqlList.add(condition);
        return this;
    }
    public String getCondition(int i){
        return paramSqlList.get(i).toString();
    }
    public void addOrder(String orderkey,boolean asc){
        if(order==null)
            order=new ArrayList<SelectItem>();
        if(asc)
            order.add(new SelectItem(orderkey,"asc"));
        else
            order.add(new SelectItem(orderkey,"desc"));
    }
    public void setParameter(Object[] parms){
        if(parms!=null)
            for (Object object : parms) {
                paramObjList.add(object);
            }
    }
    public void setParameter(Object parms){
        if(parms!=null)
            paramObjList.add(parms);
    }
    public Object getParamObj(int i){
        return paramObjList.get(i);
    }
    public List<SelectItem> getOrder(){
        return order;
    }

    public int size(){
        return paramSqlList.size();
    }
    public int paramSize(){
        return paramObjList.size();
    }
}
